package cn.faurecia.whitem.service.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.faurecia.dto.WhItem;
import cn.faurecia.whitem.dao.WhItemMapper;
import cn.faurecia.whitem.service.IwhItemService;


@Service("whItemService")
public class WhItemServiceImpl implements IwhItemService {
  private static final Logger logger = Logger.getLogger(WhItemServiceImpl.class);

  @Autowired
  private WhItemMapper itemDao;
  
  @Override
  public List<WhItem> queryByParam(WhItem item) {
    List<WhItem> dataList = itemDao.queryByParam(item);
    return dataList;
  }

  @Override
  public WhItem getItemByCode(String itemCode) {
    WhItem item = new WhItem();
    item.setItemCode(itemCode);
    List<WhItem> dataList = itemDao.queryByParam(item);
    if (dataList.isEmpty()) {
      return null;
    }else{
      return dataList.get(0);
    }
  }
  
}
